local skel = fk.CreateSkill{
  name = "mahjong_trig_skill"
}

Fk:loadTranslationTable{
  ["mahjong_trig_skill"] = "麻将",

  ["interaction_chow"] = "吃",
  ["interaction_pung"] = "碰",
  ["interaction_kong"] = "杠",
  ["interaction_rong"] = "和",
  ["interaction_empty"] = "无"
}

local KleeU = require "packages/gm_mahjong/utility/k_utility"

skel:addEffect("active", {
  mute = true,
  interaction = function (self, player)
    local choices = {}
    local cid = Fk:currentRoom():getBanner("mahjong_last")
    local cpk = KleeU.ifCardCanCPK(player, cid)
    if #cpk.C > 0 and Fk:currentRoom().current.next == player then
      table.insert(choices, "interaction_chow")
    end if #cpk.P > 0 then
      table.insert(choices, "interaction_pung")
    end if #cpk.K > 0 then
      table.insert(choices, "interaction_kong")
    end if KleeU.ifRong(player, cid) then
      table.insert(choices, "interaction_rong")
    end
    if #choices == 0 then
      return
    end
    return UI.ComboBox{
      choices = choices,
    }
  end,
  target_filter = Util.FalseFunc,
  card_filter = Util.FalseFunc,
  feasible = function (self, player, selected, selected_cards, card)
    return self.interaction.data ~= "interaction_empty"
  end
})

return skel